<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>合并两个 object 的键值对象</title>
</head>
<body>
    <script>
        var obj1 = {
            name: 'Jie ke'
        };
        var obj2 = {
            age: 18
        };
        var arr = {};// 创建一个空对象
        Object.assign(arr,obj1,obj2);// 使用深拷贝 Object.assign()方法进行合并
        console.log(arr);
    </script>
</body>
</html>